#ifndef CONNECTITEMMODEL_H
#define CONNECTITEMMODEL_H

#include <QAbstractItemModel>

struct PortConnectInfo{
	PortConnectInfo(){name="";available = false; connection="";}
	PortConnectInfo(QString n, bool a, QString c){
		name = n; available = a; connection = c;
	}
	QString name;
	bool available;
	QString connection; //version if available, empty otherwise
};

class ConnectItemModel : public QAbstractItemModel
{
	Q_OBJECT
public:

	static const quint32 SECTION_PORT					 = 0;
	static const quint32 SECTION_AVAILABLE				 = 1;
	static const quint32 SECTION_STATUS					 = 2;

	static const quint32 COUNT_SECTION					 = 3;

	explicit ConnectItemModel( QObject *parent = 0);

	void reloadData(QList<PortConnectInfo> ports);

	QVariant headerData(int section, Qt::Orientation orientation, int role) const;
	QVariant data(const QModelIndex &index, int role) const;
	QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
	QModelIndex parent(const QModelIndex &index) const;
	int rowCount(const QModelIndex &parent = QModelIndex()) const;
	int columnCount(const QModelIndex &parent = QModelIndex()) const;

signals:

public slots:

private:
	QList<PortConnectInfo> _ports;

};

#endif // CONNECTITEMMODEL_H
